const path = require('path')

module.exports = {
  module: {
    rules: [
      {
        test: /\.(js)$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env'],
          }
        }
      },
      {
        test: /.(ts|tsx)?$/,
        use: 'ts-loader',
        exclude: /node_modules/
      }
    ]
  },
  resolve: {
    // 配置文件扩展名，引入的时候可以不需要加后缀名了
    extensions: [".tsx", ".ts", ".js"],
    alias: {
      '@': path.resolve(process.cwd(), './src')
    }
  }
}